/**
 * 
 */
package reco.db.validation;

import static org.apache.commons.lang.StringUtils.isBlank;

import org.apache.commons.validator.ISBNValidator;

import reco.db.Constraint;

public class IsbnConstraint extends Constraint<String> {
    private static final ISBNValidator VALIDATOR = new ISBNValidator();

    public IsbnConstraint() {
        super("isbn", "notIsbn");
    }

    @Override
    public boolean validate(String value) {
        if (isBlank(value)) {
            return true;
        }
        return VALIDATOR.isValid(value);
    }

    @Override
    public Object[] getErrorArguments() {
        return null;
    }

}
